const app = getApp();
Component({
  data: {
    hide: app.globalData.hide,
    themeType: app.globalData.themeType,
    selected: 0,
    color: "",
    selectedColor: "",
    list: [
      {
        "pagePath": "/pages/index/index",
        "text": "首页",
        "iconPath": "/static/icon/tabbar/home.png",
        "selectedIconPath": "/static/icon/tabbar/home.png"
      },
      {
        "pagePath": "/pages/study/study",
        "text": "技术栈",
        "iconPath": "/static/icon/tabbar/study.png",
        "selectedIconPath": "/static/icon/tabbar/study.png"
      },
      {
        "pagePath": "/pages/blogs/blogs",
        "text": "博客",
        "iconPath": "/static/icon/tabbar/blogs.png",
        "selectedIconPath": "/static/icon/tabbar/blogs.png"
      },
      {
        "pagePath": "/pages/more/more",
        "text": "更多",
        "iconPath": "/static/icon/tabbar/more.png",
        "selectedIconPath": "/static/icon/tabbar/more.png"
      }
    ],
    // background: '../static/tabbar-bg.png',
    // centerImg: "/static/images/tabbar/cart.png",
  },

  attached() {
    this.setData({
      hide: app.globalData.hide
    })
    // // 如果中间凸起跳转 tabbar 页面，则把下面注释打开
    // if (this.data.selected == 2) {
    //   this.setData({
    //     centerImg: '/static/icon/xinjian.png'
    //   })
    // } else {
    //   this.setData({
    //     centerImg: '/static/icon/xinjian.png'
    //   })
    // }

    // // 显示数字提示
    // let numi = 'list[3].number'
    // this.setData({
    //   [numi]: 12
    // })
  },

  methods: {
    // 切换 tab 事件
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const path = data.path;

      wx.switchTab({
        url: path,
      });
    },
  },
});

